package final_wearebatman_view;

import java.awt.Button;
import java.awt.Frame;
import java.awt.GridBagLayout;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

// MessageBox a Race Condition feltüntetéséért
public class MessageBox extends Frame implements ActionListener {
    public MessageBox(String t) {
        super("Warning");
        setLayout(new GridBagLayout());
        Label l = new Label("Race Condition in "+t+"! Process halted.");
        Button b = new Button("OK");
        b.addActionListener(this);
        add(l);
        add(b);
        setSize(300,100);
        show();
        setLocation(200,200);
        setLocationByPlatform(true);
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                e.getWindow().dispose();
            }
        });
    }

    public void actionPerformed(ActionEvent e) {
        this.dispose();
    }
}
